const config = {
  dir: '/mocks',
  pattern: ''
}

export type MockConfig = {
  dir?: string
  pattern?: string
}

export const filePath = new Map([
  ['get', '/read'],
  ['post', '/create'],
  ['put', '/update'],
  ['delete', '/delete']
])

export const dataSchema = {
  id: '/ResponseData',
  type: 'object',
  properties: {
    records: { type: 'array' },
    total: { type: 'integer' },
    pageSize: { type: 'integer' },
    pageNum: { type: 'integer' }
  }
}

export const bodySchema = {
  id: '/ResponseBody',
  type: 'object',
  properties: {
    code: { type: 'integer' },
    msg: { type: 'string' },
    data: { $ref: '/ResponseData' },
    success: { type: 'boolean' }
  },
  additionalProperties: true
}

export const responseSchema = {
  id: '/Response',
  type: 'object',
  properties: {
    statusCode: { type: 'integer' },
    body: { $ref: '/ResponseBody' }
  }
}

export default config
